package com.zhoug.chart3.charts;

import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.data.ChartData;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
import com.github.mikephil.charting.utils.ViewPortHandler;
import com.zhoug.chart3.core.styleconfig.IMPStyleConfig;
import com.zhoug.chart3.data.HkChartData;
import com.zhoug.chart3.formatters.MPAxisTextValueFormatter;
import com.zhoug.chart3.ints.IMPChartPlaceholder;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * @Author: zhoug
 * @Date: 2024-01-30
 * @Description:
 */
public interface IMPChart<T extends ChartData<? extends IDataSet<? extends Entry>>, S extends IMPStyleConfig> {
    int ANIM_DIRECTION_X = 1;
    int ANIM_DIRECTION_Y = 2;
    int ANIM_DIRECTION_XY = 3;

    void setData1(T t);

    /**
     * 设置数据
     *
     * @param list
     */
    void setHkChartData(List<HkChartData> list);

    /***
     * {@link #ANIM_DIRECTION_X,#ANIM_DIRECTION_Y,#ANIM_DIRECTION_XY}
     *
     * @param animDirection
     */
    void setAnimateDirection(int animDirection);

    /**
     * {@link #ANIM_DIRECTION_X,#ANIM_DIRECTION_Y,#ANIM_DIRECTION_XY}
     *
     */
    int getAnimateDirection( );

    void setStyleConfig(@NonNull S styleConfig);

    @NonNull
    S getStyleConfig();

    /**
     * 暂无数据
     */
    void empty();

    /**
     * 数据加载失败
     */
    void error();

    /**
     * 重置占位图
     */
    void resetPlaceholder();

    /**
     * 占位图是否启用
     *
     * @return
     */
    void setPlaceholderEnable(boolean enable);

    /**
     * 设置占位图绘制工具
     *
     * @param chartPlaceholder
     */
    void setChartPlaceholder(IMPChartPlaceholder chartPlaceholder);

    /**
     * x轴开始的最小值
     *
     * @return
     */
    int getStartXValue();

    /**
     * 不缩放,x,y的scale重置为1
     */
    void zoomNotScale();

    /**
     * 获取x轴数据格式化器
     *
     * @return
     */
    @Nullable
    MPAxisTextValueFormatter getAxisTextValueFormatter();

    //#########以下方法从Chart<?>中提取#################

    void notifyDataSetChanged();

    void postInvalidate();

    void animateX(int durationMillis);

    void animateY(int durationMillis);

    void animateXY(int durationMillisX, int durationMillisY);

    XAxis getXAxis();

    ViewPortHandler getViewPortHandler();

    void zoom(float scaleX, float scaleY, float x, float y);

}
